package org.dromara.tearoom.mqtt;

import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.utils.SpringUtils;
import org.dromara.tearoom.domain.enums.IotDeviceBreakerEnum;
import org.dromara.tearoom.service.IBreakerCommandService;
import org.dromara.tearoom.service.impl.GeeOpenCommandServiceImpl;

/**
 *  断路器的工厂类 根据设备品牌不同 去找不同的服务
 * 实现 IBreakerCommandService 接口即可
 * @author CKJ
 * @description: 后续有不同的断路器供应商 调用方式不同的话 可在此扩展
 * @date 2025/4/15 18:34
 */
@Slf4j
public class BreakerFactory {


    public static IBreakerCommandService getBreakerCommandService(IotDeviceBreakerEnum brand) {
        switch (brand) {
            case GeeOpen:
                return SpringUtils.getBean(GeeOpenCommandServiceImpl.class);
            default:
                log.warn("未找到相对应的第三方断路器！启动了默认GeeOpen的断路器！");
                return SpringUtils.getBean(GeeOpenCommandServiceImpl.class);
        }
    }

}
